home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kaccelmanager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.9 KB  |  89 lines

  1. /*  This file is part of the KDE project
  2.     Copyright (C) 2002 Matthias Hoelzer-Kluepfel <mhk@kde.org>
  3.  
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     License as published by the Free Software Foundation; either
  7.     version 2 of the License, or (at your option) any later version.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.     Boston, MA 02110-1301, USA.
  18. */
  19.  
  20.  
  21. #ifndef __K_ACCELMANAGER_H__
  22. #define __K_ACCELMANAGER_H__
  23.  
  24.  
  25. class QWidget;
  26. class QString;
  27.  
  28. #include <kdelibs_export.h>
  29.  
  30. /**
  31.  * KDE Accelerator manager.
  32.  *
  33.  * This class can be used to find a valid and working set of
  34.  * accelerators for any widget.
  35.  *
  36.  * @author Matthias Hoelzer-Kluepfel <mhk@kde.org>
  37.  * @since 3.1
  38. */
  39.  
  40. class KDECORE_EXPORT KAcceleratorManager
  41. {
  42. public:
  43.  
  44.     /**
  45.      * Manages the accelerators of a widget.
  46.      *
  47.      * Call this function on the top widget of the hierarchy you
  48.      * want to manage. It will fix the accelerators of the child widgets so
  49.      * there are never duplicate accelerators. It also tries to put
  50.      * accelerators on as many widgets as possible.
  51.      *
  52.      * The algorithm used tries to take the existing accelerators into
  53.      * account, as well as the class of each widget. Hopefully, the result
  54.      * is close to what you would assign manually.
  55.      *
  56.      * QPopupMenu's are managed dynamically, so when you add or remove entries,
  57.      * the accelerators are reassigned. If you add or remove widgets to your
  58.      * toplevel widget, you will have to call manage again to fix the
  59.      * accelerators.
  60.      *
  61.      * @param widget The toplevel widget you want to manage.
  62.      */
  63.  
  64.     static void manage(QWidget *widget);
  65.  
  66.     /**
  67.      * Does the same as the above function, but puts hints in the GUI so the
  68.      * programmer can enhance his program.
  69.      *
  70.      * TODO KDE4: merge with the above
  71.      * @param widget The toplevel widget you want to manage.
  72.      * @param programmers_mode if true, KAcceleratorManager adds (&) for removed
  73.      *             accels and & before added accels
  74.      */
  75.     static void manage(QWidget *widget, bool programmers_mode);
  76.  
  77.     /** \internal returns the result of the last manage operation. */
  78.     static void last_manage(QString &added,  QString &changed,  QString &removed);
  79.  
  80.     /**
  81.      * Use this method for a widget (and its children) you want no accels to be set on.
  82.      * @since 3.4
  83.      */
  84.     static void setNoAccel( QWidget *widget );
  85. };
  86.  
  87.  
  88. #endif
  89.